<?php
/**
 * Class representing a video of Mikubook
 */
class Mikubook_Video {
	
	var $id;
	var $title;
	var $image;
	var $link;
	var $linkEmbed;
	var $favecount;
	var $rome;
	
	public function __construct($feed = array()) {
		if (is_array($feed)) {
			foreach ($feed as $name => $value) {
				$this->$name = $value;
			}
		}
		
		$this->checkImage();
	}
	
	public function checkImage() {
		if (substr($this->image, 0, 7) != "http://") {
			$this->image = "http://mikubook.com".$this->image;
		}
	}
	
	public function getLinkEmbed($opts = array()) {
		return Youtube_Helper::linkToEmbed($this->link, $opts);
	}
}
?>